package com.woniuxy.creditsystem.statisticsmag.controller;

import com.github.pagehelper.PageInfo;
import com.woniuxy.creditsystem.common.bean.FinanceInfo;
import com.woniuxy.creditsystem.common.bean.OverdueStatisticsInfo;
import com.woniuxy.creditsystem.statisticsmag.page.PageRequest;
import com.woniuxy.creditsystem.statisticsmag.page.TableResult;
import com.woniuxy.creditsystem.statisticsmag.service.IFinanceService;
import com.woniuxy.creditsystem.statisticsmag.service.IOverdueStatisticsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * 逾期统计Controller
 * @author 刘川
 */
@RequestMapping("/overdue")
@RestController
public class OverdueStatisticsController {
    @Resource
    private IOverdueStatisticsService overdueStatisticsServiceImpl;

    /**
     * 逾期的所有数据的分页查询
     * @param request
     * @param overdueStatisticsInfo
     * @return
     */
    @GetMapping(value="/page", produces = {"application/json;charset=utf-8"})
    public TableResult<OverdueStatisticsInfo> findAllByParams(PageRequest request, OverdueStatisticsInfo overdueStatisticsInfo){
        System.out.println(request);
        System.out.println(overdueStatisticsInfo);

        PageInfo<OverdueStatisticsInfo> pageInfo = overdueStatisticsServiceImpl.findAllByParams(request,overdueStatisticsInfo);
        System.out.println(pageInfo);
        return new TableResult<OverdueStatisticsInfo>(pageInfo.getTotal(),pageInfo.getList());
    }



}
